package com.soladhoc.annonces.server.guice;

import javax.inject.Singleton;

import com.google.inject.servlet.ServletModule;
import com.google.web.bindery.requestfactory.server.RequestFactoryServlet;
import com.gwtplatform.dispatch.shared.ActionImpl;
import com.gwtplatform.dispatch.server.guice.DispatchServiceImpl;
import com.soladhoc.annonces.server.servlet.AuthFilter;

public class DispatchServletModule extends ServletModule {

	@Override
	public void configureServlets() {
		// RequestFactory servlet
		bind(RequestFactoryServlet.class).in(Singleton.class);
		serve("/gwtRequest").with(RequestFactoryServlet.class);

		// GWT platform commands servlet
		serve("/" + ActionImpl.DEFAULT_SERVICE_NAME).with(
				DispatchServiceImpl.class);

		filter("/authFilter").through(AuthFilter.class);
	}
}
